
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%><%@ include file="pub/top.jsp"%>
<%@page
	import="hyl.core.db.*,java.util.Map,com.servlet.*,hyl.core.info.Content,hyl.core.MyFun"%>
<!-- 全局变量 函数定义区 -->
<%!%>
<!-- 实例变量 函数定义区 -->
<%
//网页title
String JSPTITLE = "更新应用";
int id = MyFun.str2int(request.getParameter("id"));

String sql = "SELECT a.id,a.appid,a.t0,a.t1,a.t2,a.t3,a.t4,a.t5,a.t6,a.t7,a.t8,a.t9,a.t10,a.t11,a.t13,a.t14,a.t15,a.tm0,a.i0,a.l0,a.dt0 FROM app a where a.id=?";
Object[] params = {id};
Map<String, Object> result = My.getDB1().queryMap(sql, params);
//MyFun.print(sql,id);
MyFun.print(JSON.toJSONString(result));
int i0 = MyFun.obj2Int(result.get("i0"));
%>

<%@ include file="pub/headform.jsp"%>


<!-- 样式添加区 -->
<style>
body {
	background-color: #fff
}

.mmar {
	margin-left: 25%
}
</style>


<link rel="stylesheet"
	href="<%=basePath%>assets/css/jquery-ui.custom.min.css" />
<!-- 下右内容区 -->
<div class="main-content-inner">
	<div class="breadcrumbs ace-save-state" id="breadcrumbs">
		<ul class="breadcrumb">
			<li><i class="ace-icon fa fa-home home-icon"></i> 第三方应用管理</li>
			<li class="active"><%=JSPTITLE%></li>
		</ul>
	</div>
	<div class="page-content">
		<!-- page-header{ -->
		<div class="page-header">

			<div class="row">
				<div class="col-xs-12">
					<div class="clearfix">
						<div class="pull-right tableTools-container"></div>
						<div class="">
							<div class="btn-group" style="margin-top: 5px">
								<a href="#" class="btn-refresh btn  btn-xs "> <i
									class="im-spinner10 fa-spin"></i> 刷新
								</a>
							</div>
						</div>
					</div>

				</div>
			</div>

		</div>
		<!-- }page-header  -->

		<!-- table header2{ -->
		<div class="row">
			<div class="col-xs-9 tablehead2L"></div>
			<div class="col-xs-3 tablehead2R"></div>
		</div>
		<!-- }table -header2  -->
		<!--  table { -->

		<div class="row" id="el">
			<div class="col-xs-12">

				<form class="form-horizontal" action="" role="form">
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> app名称</span><br>
						<input type="text" name="t0" class="width-45 mmar" disabled v-model="t0" />
					</div>

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> app分类</span><br>
						<input type="text" name="t4" class="width-45 mmar" v-model="t4" />
					</div>
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 联系人姓名</span><br>
						<input type="text" name="t1" class="width-45 mmar" v-model="t1" />
					</div>

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 联系人号码</span><br>
						<input type="text" name="t2" class="width-45 mmar" v-model="t2" />
					</div>

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 授权域名</span><br>
						<input type="text" name="t3" class="width-45 mmar" disabled v-model="t3" />
					</div>

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i>应用logo</span><br>

						<input id="uploadFileInput1" type="file" style="display: none"
							size="45" name="uploadFileInput1" class="uploadFileInput" /> <img
							id="avatar1" class="editable img-responsive mmar"
							style="width: 200px; height: 200px; float: left"
							src="<%=basePath%>img/picnew.png" onclick="picclick(1)"
							alt="图片要求：彩色，清晰，2M以内">
					</div>

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 时间戳</span><br>
						<input type="text" name="l0" class="width-45 mmar" disabled v-model="l0" />
					</div>
				

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> app版本</span><br>

						<input type="text" name="t5" class="width-45 mmar" disabled v-model="t5" />
					</div>
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 编程语言+版本</span><br>
						<input type="text" name="t6" class="width-45 mmar" disabled v-model="t6" />
					</div>

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 工作目录</span><br>
						<input type="text" name="t7" class="width-45 mmar" disabled v-model="t7" />
					</div>
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 操作系统</span><br>
						<input type="text" name="t8" class="width-45 mmar" disabled v-model="t8" />
					</div>
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 操作系统位数</span><br>

						<input type="text" name="t9" class="width-45 mmar" disabled v-model="t9" />
					</div>
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 操作系统版本</span><br>

						<input type="text" name="t10" class="width-45 mmar"  disabled v-model="t10" />
					</div>

					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 操作系统用户</span><br>

						<input type="text" name="t11" class="width-45 mmar" disabled v-model="t11" />
					</div>
					<!-- 12 密钥 -->
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 微服务IP</span><br>

						<input type="text" name="t13" class="width-45 mmar" disabled v-model="t13" />
					</div>
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 进程 psid</span><br>
						<input type="text" name="t14" class="width-45 mmar" disabled v-model="t14" />
					</div>

						<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 备注</span><br>
						<input type="text" name="t15" class="width-45 mmar"  v-model="t15" />
					</div>

					
					<div class="form-group">
						<span class="mmar"><i style="color: red">*</i> 是否允许接入</span><br>
						<div class="radio width-45 mmar">
							<label> <input type="radio" name="i0" class="ace"
								value="0" v-model="i0" /> <span class="lbl"> 禁止</span>

							</label> <label> <input type="radio" name="i0" class="ace"
								value="1" v-model="i0" /> <span class="lbl"> 待审批</span>
							</label>
							<label> <input type="radio" name="i0" class="ace"
								value="2" v-model="i0" /> <span class="lbl"> 允许</span>
							</label>
						</div>
					</div>
					<div class="form-group">
						<input type="button" class="btn btn-danger btn-block met1 width-35"
							style="margin-left: 30%" v-on:click="submit1" value="变更">
					</div>

				</form>

			</div>
		</div>
	</div>

</div>

<a href="#" id="btn-scroll-up"
	class="btn-scroll-up btn btn-sm btn-inverse"> <i
	class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>

<%@ include file="pub/bottom.jsp"%>


<!-- 自定义脚本 加载区 -->
<script>
const _table_='<%=JSPTITLE%>';
const BASEPATH='<%=basePath%>';
const UPLOADURL='<%=M2.get上传路径()%>';
var flag=0;
var data={
		  id:<%=result.get("id")%>,
		  appid:'<%=result.get("appid")%>',
		  t0:'<%=result.get("t0")%>',
		  t1:'<%=result.get("t1")%>',
		  t2:'<%=result.get("t2")%>',
		  t3:'<%=result.get("t3")%>',
		  t4:'<%=result.get("t4")%>',
		  t5:'<%=result.get("t5")%>',
		  t6:'<%=result.get("t6")%>',
		  t7:'<%=MyFun.jsEscape((String)result.get("t7"))%>',
		  t8:'<%=result.get("t8")%>',
		  t9:'<%=result.get("t9")%>',
		  t10:'<%=result.get("t10")%>',
		  t11:'<%=result.get("t11")%>',
		  t12:'<%=result.get("t12")%>',
		  t13:'<%=result.get("t13")%>',
		  t14:'<%=result.get("t14")%>',
		  t15:'<%=MyFun.nvl(result.get("t15"), "")%>',
		  i0:<%=result.get("i0")%>,
		  l0:<%=result.get("l0")%>,
		  dt0:'<%=result.get("dt0")%>',
		  tm0:'<%=result.get("tm0")%>'
	  };
	//  alert(data["i0"])
new Vue({
  el: '#el',
  data: data,
  methods:{
	  submit1:function(){		
			var pic = getCar(_table_);		
			var params={
				id: this.id,	
				i0: this.i0,
				t1: this.t1,
				t2: this.t2,			
				t4: this.t4,	
				t15: this.t15,		
				tm0 : JSON.stringify(pic)
			};


			$.ajax({
				type : 'post',
				url : BASEPATH + 'admin/Dao/app_xg_1.jsp',
				data : params,
				success : function(result) {
					if (result.indexOf("success")) {
						alert("提交成功!");
						window.location.reload();
					} else {
						alert("请确认表单是否正确");			
						return;
					}
				}
			});
		}
  }
})
</script>
<script>
/*传入html字符串源码即可*/


	$('.bt-back').click(function() {
		history.go(-1);
	});

	//只允许输入数字
	$(".onlynum").keyup(function() {
		var c = $(this);
		if (/[^\d]/.test(c.val())) {//替换非数字字符  
			var temp_amount = c.val().replace(/[^\d]/g, '');
			$(this).val(temp_amount);
		}
	})

	function getStorage(key) {
		var storage = window.sessionStorage;
		if (storage.getItem(key))
			return JSON.parse(storage.getItem(key));
		else
			return null;
	}
	function setStorage(key, value) {
		var storage = window.sessionStorage;
		storage.setItem(key, JSON.stringify(value));
	}
	//购物车模式
	function getCar(key) {
		var li = getStorage(key);
		if (li == undefined || li == null) {
			li = [];
		}
		return li;
	}

	var picname; //avatar1
	var pubid;//uploadFileInput1
	function picclick(id) {
		pubid = "uploadFileInput" + id;
		$('#' + pubid).click();
		picname = "avatar" + id;
	}
	$(".uploadFileInput").change(function() {
		ajaxFileUpload(picname);
	});

	function addsl(ids, paths) {
		var obj2 = {
			id : ids,
			path : paths
		};
		var li = [];
		li.push(obj2);
		setStorage(_table_, li);
	}

	//添加c2c时上传图片
	function ajaxFileUpload(picname) {
		$("#loading").ajaxStart(function() {
			$(this).show();
		})//开始上传文件时显示一个图片  
		.ajaxComplete(function() {
			$(this).hide();
		});//文件上传完成将图片隐藏起来   
		var crowd_file = $('#' + pubid)[0].files[0];
		var formData = new FormData();
		var url= UPLOADURL + "&g1=logo&t=3";
		console.log(url);
		formData.append("crowd_file", crowd_file);
		$.ajax({//
			url :url,
			dataType : 'json',
			type : 'POST',
			async : false,
			data : formData,
			processData : false, // 使数据不做处理
			contentType : false, // 不要设置Content-Type请求头
			success : function(result) {
				var arrs = JSON.parse(result.MSG);
				if (arrs[0]) {
					$('#' + picname).attr('src', arrs[0].path)
					addsl(picname, arrs[0].path);
				}
			},
			error : function(response) {
				console.log(response);
			}
		});
	}
</script>
